﻿var MyWebsiteGallery = (function ($) {
    var initLayout = function () {
        SelectMenu("gallery");
        AnimateText();
        initToolTip();
        bindEvents();
    }

    function initToolTip() {
        $('.hastooltip').each(function () { // Notice the .each() loop, discussed below
            $(this).qtip({
                style: { classes: 'qtip-light' },
                content: {
                    text: $(this).next('div') // Use the "div" element next to this for the content
                }
            });
        });
    }

    function displayAlbumImages(){
        var albumID = $(this).attr('albumId');
        var imageCount =$(this).attr('imgCount');
        if (albumID && imageCount) {
            //redirect to gallery with a queryString param 
            window.location.href = '/Gallery.aspx?AlbumId=' + albumID ;
        }
    }

    function bindEvents() {
        $('body').on('click', '.albumClick', displayAlbumImages);

    }


    return {
        init: initLayout
    }

})(jQuery)

$(document).ready(function () {
    var gallery = MyWebsiteGallery;
    gallery.init();
    
});